package com.xiaozhen.blog.controller;


import com.xiaozhen.blog.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @create 2023-04-22 15:36
 */
@Controller
@RequestMapping("/archives")
public class ArchiveController {
    @Autowired
    private BlogService blogService;

    @GetMapping
    public String archive(Model model) {
        // 1.获得博客创建的时间
        // 2.通过时间获得该时间内博客的数量
        // 3.获得博客的标题和修改时间信息
        model.addAttribute("archiveMap", blogService.archiveBlog());
        return "archives";
    }
}
